<!-- 话题页面 -->
<template>
	<z-paging ref="paging" v-model='dataList' v-if="isshow"
	@query='queryList' :default-page-no="1" :default-page-size="10"
		:hide-empty-view="Boolean(dataList.length)">
		<!-- <view style="height:30rpx;opacity: 0;"></view> -->
		<!-- #ifdef APP-PLUS -->
		<!-- <view class="bg" slot='top'>已知话题</view> -->
		<!-- #endif -->
		<topItem :dataList='dataList'></topItem>
		<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/newIcon/commentBig.png" class="release" @click='release'></image>
	</z-paging>
</template>

<script>
	import topItem from './modules/topicItem.vue'
	import {
		topicList,
		memberTopic,
		savePageRecord,
	} from '@/apis/apis.js'
	export default {
		components: {
			topItem
		},
		data() {
			return {
				dataList: [],
				pageNum:1,
				pageSize:10,
				isshow:false
			}
		},
		onShow() {
			this.isshow = true
			// console.log('进入主页')
		},
		onLoad(options) {
			console.log(options)
		},
		onHide() {
			this.isshow = false
			// console.log('离开主页')
		},
		methods: {
			queryList(pageNo, pageSize) {
				this.pageNum = pageNo
				topicList({
					pageNum: pageNo,
					pageSize: pageSize
				}).then(res => {
					res.data.forEach((el, index) => {
						if (el.workKey) {
							el.words = el.workKey.split(',')
						}
						//置顶
						if (el.topping) {
							res.data.unshift(res.data.splice(index, 1)[0]);
						}
					})
					this.$refs.paging.complete(res.data);
				})
			},
			//发布
			release() {
				uni.navigateTo({
					url: './release/release'
				})
			}
		},
	}
</script>

<style lang='scss' scoped>
	.bg {
		width: 100%;
		font-size: 32rpx;
		text-align: center;
		font-weight: bold;
		color: #FFFFFF;
		background: #194FC9;
		padding-top: calc(35rpx + var(--status-bar-height));
		padding-bottom: 35rpx;
	}

	.release {
		width: 120rpx;
		height: 120rpx;
		position: fixed;
		right: 18rpx;
		bottom: 162rpx;
		z-index: 9;
	}
</style>
